#ifndef LIGHTING_APP_H
#define LIGHTING_APP_H

//=============================================================================
//
// Demostrates lighting phong model. (diffuse, ambient, specular lights)
// (parallel, point , spot lights)
//
// Controls:
// - A, D, W, S: Move Camera
// - X, Z: Zoom in, zoom out
// - N, M: Decrement, increment spot light cone angle.
// - 1, 2, 3: Change light to: parallel, point or spot.
//
//=============================================================================

#include "d3dApp.h"
#include "Grid.h"
#include "Light.h"
#include "Waves.h"

namespace D3D10
{
	class LightingApp : public D3DApp
	{
	public:
		LightingApp(const HINSTANCE hInstance);
		~LightingApp();
	
		void initApp();
		void onResize();
		void updateScene(const float deltaTime);
		void drawScene(); 
	
	private:
		void buildRenderStates();
		void buildFX();
		void buildVertexLayouts();
	
	private:	
		D3D10Utils::Grid mGrid;
		D3D10Utils::Waves mWaves;
	
		ID3D10Effect *mEffect;
		ID3D10EffectTechnique *mTechnique;
		ID3D10InputLayout *mVertexLayout;
		ID3D10EffectMatrixVariable* mEffectWVPVariable;
		ID3D10EffectMatrixVariable* mEffectWorldVar;

		ID3D10RasterizerState *mWireframeRS;

		ID3D10EffectVariable *mEffectEyePosVar;
		ID3D10EffectVariable *mEffectLightVar;
		ID3D10EffectScalarVariable *mEffectLightType;
	
		D3DXMATRIX mLandWorld;
		D3DXMATRIX mWavesWorld;

		D3DXMATRIX mView;
		D3DXMATRIX mProjection;
		D3DXMATRIX mWVP;

		D3DXVECTOR3 mEyePos;

		const D3DXCOLOR mClearColor;

		D3D10Utils::Light mLights[3];
		int mLightType;
	
		float mRadius;
		float mTheta;
		float mPhi;
	};
}

#endif // LIGHTING_APP_H
